1. Field of the Invention
The invention relates to the field of computer systems. More specifically, the invention relates to software debugging.
2. Background Information
Software debugging is the detecting, locating, and correcting of logical and/or syntactical errors in a computer program. Debug hardware is often included in a processor for use by a software debug program. Typically, the debug program uses the debug hardware to allow the programmer to examine data and check conditions during the execution of another computer program. Thus, the debugging features of a processor provide programmers with valuable tools for looking at the dynamic state of the processor.
A prior art method and apparatus for aiding in software debugging is included in the Intel.RTM. Pentium.TM. microprocessor manufactured by Intel Corporation of Santa Clara, Calif. The Pentium microprocessor includes 4 address breakpoint registers, each capable of storing the linear address of a breakpoint (i.e., the address of a memory or I/O location). In addition, the Pentium processor also includes indications for each breakpoint register specifying the type of breakpoint address stored therein: 1) break on instruction execution only; 2) break on data writes only; 3) break on I/O reads or writes; and 4) break on data reads or writes but not on instruction fetches. In addition, the Pentium processor includes circuitry for calling a debug software routine (referred to herein as the "debug handler") when one or more of these breakpointed locations is accessed and the appropriate corresponding indications are properly set.
For example, the programmer may store in a breakpoint register the address of a particular instruction and identify that address as a break on instruction execution only breakpoint address. When the processor accesses the instruction corresponding to the breakpoint address, a breakpoint event is reported. It is worthwhile to note that breakpoint comparisons are performed before physical address translation occurs. In addition, it is worthwhile to note that the term "event" is used herein to refer to any action or occurrence to which a computer system might respond (e.g., hardware interrupts, software interrupts, exceptions, faults, traps, aborts, machine checks, debug events).
Upon receiving the breakpoint event, the processor's event handling mechanism causes the processor to interrupt execution of the current process, store the interrupted process' execution environment (i.e., the information necessary to resume execution of the interrupted process), and invoke the debug handler. The debug handler is a portion of the debug program that allows the programmer to perform a variety of debugging techniques. When the programmer is finished, the programmer can instruct the debug handler to cause the processor to resume the interrupted process using the process' previously stored execution environment. For a further description of the Pentium processor see: Pentium Processor's Users Manual--Volume 3: Architecture and Programming Manual, 1994, available from Intel Corporation of Santa Clara, Calif.
The Pentium processor also includes a 2-bit range indication for each breakpoint register that specifies the address range of the breakpointed location. An address range of 1, 2, or 4 bytes may be specified. For example, if the 4 byte range is selected, a breakpoint fault will occur if any one of the four bytes starting at the breakpoint address are accessed. Since the selectable address ranges are 1, 2, or 4 bytes, the lower 2-bits of the breakpoint address are not used. The circuitry on the Pentium processor for determining if an address falls within this address range includes: 1) comparison logic for comparing the upper 30-bits of the breakpoint address with the upper 30-bits of the address to be matched; and 2) combinational logic (also termed as "random logic") to determine if the lower 2-bits of the address falls within the address range identified by the 2-bit range indication.
A limitation of the Pentium processor is the size of the breakpoint location which may be specified as a breakpoint (i.e., the largest possible size is 4 bytes). The size of the breakpoint locations in the Pentium processor was limited to a maximum of 4 bytes because the combinational logic used to define the breakpoint address ranges requires a significant amount of die space. Since the size of breakpoint locations in the Pentium processor is limited to a maximum of 4 bytes, the largest possible area of coverage using all four breakpoint registers is 16 bytes. However, research shows that it is desirable to be able to define larger address ranges. For example, it is sometimes desirable to cause a debug event upon an access to a common data structure or to a section of code. However, it is often the case that data structures and sections of code are larger than 16 bytes.